<template>
  <div>
    <div class="title"><span>新增通道</span></div>
    <div class="container">
      <div class="itemBox">
        <div class="line">
          <div class="lineitem">通道名称</div>
          <div class="lineitem">
            <el-input
              class="inputsize"
              v-model="channelinfo.channelname"
              placeholder="请输入通道名称"
            ></el-input>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">服务商机构号</div>
          <div class="lineitem">
            <el-input
              class="inputsize"
              v-model="channelinfo.instNo"
              placeholder="请输入服务商机构号"
            ></el-input>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">通道状态</div>
          <div class="lineitem">
            <el-select
              v-model="channelinfo.status"
              placeholder="请选择通道状态"
            >
              <el-option
                v-for="item in channelStatus"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">系统商签约协议的PID</div>
          <div class="lineitem">
            <el-input
              class="inputsize"
              v-model="channelinfo.aliIsvPid"
              placeholder="请输入系统商签约协议的PID"
            ></el-input>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">通道支付类型</div>
          <div class="lineitem">
            <el-input
              class="inputsize"
              v-model="channelinfo.paytype"
              placeholder="请输入通道支付类型"
            ></el-input>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">AES/DES密钥</div>
          <div class="lineitem">
            <el-input
              class="inputsize"
              v-model="channelinfo.instKey"
              placeholder="请输入AES/DES密钥"
            ></el-input>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">通道类型</div>
          <div class="lineitem">
            <el-select v-model="channelinfo.type" placeholder="请选择通道类型">
              <el-option
                v-for="item in channelTypeList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">RSA公钥-三方</div>
          <div class="lineitem">
            <el-input
              class="inputsize"
              v-model="channelinfo.instPublicKey"
              placeholder="请输入RSA公钥-三方"
            ></el-input>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">是否有银行卡支付周期</div>
          <div class="lineitem">
            <el-select v-model="channelinfo.isCardPay" placeholder="请选择">
              <el-option
                v-for="item in isCardPayList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
        </div>

        <div class="line">
          <div class="lineitem">RSA私钥-服务商</div>
          <div class="lineitem">
            <el-input
              class="inputsize"
              v-model="channelinfo.instParamKey"
              placeholder="请输入RSA私钥-服务商"
            ></el-input>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">是否有进件接口</div>
          <div class="lineitem">
            <el-select v-model="channelinfo.isEntry" placeholder="请选择">
              <el-option
                v-for="item in isEntryList"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              >
              </el-option>
            </el-select>
          </div>
        </div>

        <div class="line">
          <div class="lineitem">平台储蓄卡封顶费用(分)</div>
          <div class="lineitem">
            <el-input
              class="inputsize"
              v-model="channelinfo.platformDebitcardTopFee"
              placeholder=""
            ></el-input>
          </div>
        </div>

        <div class="line">
          <div class="lineitem">appid/或者sallerid</div>
          <div class="lineitem">
            <el-input
              class="inputsize"
              v-model="channelinfo.instAppid"
              placeholder=""
            ></el-input>
          </div>
        </div>

        <div class="line">
          <div class="lineitem">通道支持结算周期</div>
          <div class="lineitem">
            <el-checkbox-group v-model="settlement" @change="CheckedChange">
              <el-checkbox
                v-for="settlement in settlementList"
                :label="settlement"
                :key="settlement"
                >{{ settlement }}</el-checkbox
              >
            </el-checkbox-group>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">平台信用卡成本费率(万分比)</div>
          <div class="lineitem">
            <el-input
              class="inputsize"
              v-model="channelinfo.platformCreditcardProfitRate"
              placeholder=""
            ></el-input
            >‱
          </div>
        </div>
        <div class="line">
          <div class="lineitem">平台储蓄卡成本费率(万分比)</div>
          <div class="lineitem">
            <el-input
              class="inputsize"
              v-model="channelinfo.platformDebitcardProfitRate"
              placeholder=""
            ></el-input
            >‱
          </div>
        </div>
        <!-- <div class="line">
          <div class="lineitem">分账标识</div>
          <div class="lineitem">
            <el-select
              v-model="channelinfo.splitType"
              placeholder="请选择分账标识"
            >
            <el-option keys="1" label="不支持" :value="0"></el-option>
            <el-option keys="1" label="收付一体" :value="1"></el-option>
            <el-option keys="1" label="仅分账" :value="2"></el-option>
            </el-select>
          </div>
        </div> -->

        <div class="line">
          <div class="lineitem">通道图标</div>
          <div class="lineitemIcon">
            <el-upload
              class="avatar-uploader"
              :action="upload"
              :headers="token"
              :show-file-list="false"
              :on-success="PicSuccess"
            >
              <img
                v-if="channelinfo.icon"
                :src="channelinfo.icon"
                class="avatar"
                style="width: 100%; height: 100%"
              />
              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">微信授权码 </div>
          <div class="lineitemIcon">
            <el-upload
              class="avatar-uploader"
              :action="upload"
              :headers="token"
              :show-file-list="false"
              :on-success="wxQrSuccess"
            >
              <img
                v-if="channelinfo.wxQr"
                :src="channelinfo.wxQr"
                class="avatar"
                style="width: 100%; height: 100%"
              />
              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
          </div>
        </div>
        <div class="line">
          <div class="lineitem">支付宝授权码  </div>
          <div class="lineitemIcon">
            <el-upload
              class="avatar-uploader"
              :action="upload"
              :headers="token"
              :show-file-list="false"
              :on-success="aliQrSuccess"
            >
              <img
                v-if="channelinfo.aliQr"
                :src="channelinfo.aliQr"
                class="avatar"
                style="width: 100%; height: 100%"
              />
              <i v-else class="el-icon-plus avatar-uploader-icon"></i>
            </el-upload>
          </div>
        </div>
      </div>


      <div class="wxbox">
        <div class="h4"><h4>微信</h4></div>
        <div class="linebox">
          <div class="line">
            <div class="lineitem">微信appid</div>
            <div class="lineitem">
              <el-input
                class="inputsize"
                v-model="channelinfo.wxServAppid"
                placeholder=""
              ></el-input>
            </div>
          </div>
          <div class="line">
            <div class="lineitem">小程序appid</div>
            <div class="lineitem">
              <el-input
                class="inputsize"
                v-model="channelinfo.wxMiniAppid"
                placeholder=""
              ></el-input>
            </div>
          </div>
          <div class="line">
            <div class="lineitem">微信密钥</div>
            <div class="lineitem">
              <el-input
                class="inputsize"
                v-model="channelinfo.wxServSecret"
                placeholder=""
              ></el-input>
            </div>
          </div>
          <div class="line">
            <div class="lineitem">小程序密钥</div>
            <div class="lineitem">
              <el-input
                class="inputsize"
                v-model="channelinfo.wxMiniSecret"
                placeholder=""
              ></el-input>
            </div>
          </div>
          <!-- <div class="line">
            <div class="lineitem">微信服务商公众号支付成功消息模板id</div>
            <div class="lineitem">
              <el-input
                class="inputsize"
                v-model="channelinfo.wxServPst"
                placeholder=""
              ></el-input>
            </div>
          </div> -->
          <div class="line">
            <div class="lineitem">微信服务商商户号(官方通道)</div>
            <div class="lineitem">
              <el-input
                class="inputsize"
                v-model="channelinfo.wxMchid"
                placeholder=""
              ></el-input>
            </div>
          </div>
          <!-- <div class="line">
            <div class="lineitem">微信服务商公众号退款成功消息模板id</div>
            <div class="lineitem">
              <el-input
                class="inputsize"
                v-model="channelinfo.wxServRst"
                placeholder=""
              ></el-input>
            </div>
          </div> -->
          <div class="line">
            <div class="lineitem">微信服务商key(官方通道)</div>
            <div class="lineitem">
              <el-input
                class="inputsize"
                v-model="channelinfo.wxKey"
                placeholder=""
              ></el-input>
            </div>
          </div>
          <div>
            <div class="h4"><h4>费率(万分比)</h4></div>
            <div class="tablebox">
              <table>
                <tr>
                  <td>扫码支付</td>
                  <td>二维码支付</td>
                  <td>JS支付</td>
                  <td>WAP支付</td>
                  <td>APP支付</td>
                  <td>小程序支付</td>
                </tr>
                <tr>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wxProfitRate[0]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wxProfitRate[1]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wxProfitRate[2]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wxProfitRate[3]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wxProfitRate[4]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wxProfitRate[5]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
      <div class="wxbox">
        <div class="h4"><h4>支付宝</h4></div>
        <div class="linebox">
          <div class="line">
            <div class="lineitem">支付宝分配给开发者的应用ID</div>
            <div class="lineitem">
              <el-input
                class="inputsize"
                v-model="channelinfo.aliIsvAppid"
                placeholder=""
              ></el-input>
            </div>
          </div>

          <div>
            <div class="h4"><h4>费率(万分比)</h4></div>
            <div class="tablebox">
              <table>
                <tr>
                  <td>扫码支付</td>
                  <td>二维码支付</td>
                  <td>JS支付</td>
                  <td>WAP支付</td>
                  <td>APP支付</td>
                  <td>小程序支付</td>
                </tr>
                <tr>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="aliProfitRate[0]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="aliProfitRate[1]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="aliProfitRate[2]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="aliProfitRate[3]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="aliProfitRate[4]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="aliProfitRate[5]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
      <div class="wxbox">
        <div class="h4"><h4>银联云闪付</h4></div>
        <div class="linebox">
          <div>
            <div class="h4"><h4>费率(万分比)</h4></div>
            <div class="tablebox">
              <table>
                <tr>
                  <td>扫码支付</td>
                  <td>二维码支付</td>
                  <td>JS支付</td>
                  <td>WAP支付</td>
                  <td>APP支付</td>
                  <td>小程序支付</td>
                </tr>
                <tr>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="uniProfitRate[0]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="uniProfitRate[1]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="uniProfitRate[2]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="uniProfitRate[3]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="uniProfitRate[4]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="uniProfitRate[5]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
      <div class="wxbox">
        <div class="h4"><h4>翼支付</h4></div>
        <div class="linebox">
          <div>
            <div class="h4"><h4>费率(万分比)</h4></div>
            <div class="tablebox">
              <table>
                <tr>
                  <td>扫码支付</td>
                  <td>二维码支付</td>
                  <td>JS支付</td>
                  <td>WAP支付</td>
                  <td>APP支付</td>
                  <td>小程序支付</td>
                </tr>
                <tr>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="bestpayProfitRate[0]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="bestpayProfitRate[1]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="bestpayProfitRate[2]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="bestpayProfitRate[3]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="bestpayProfitRate[4]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="bestpayProfitRate[5]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
      <div class="wxbox">
        <div class="h4"><h4>数字人民币</h4></div>
        <div class="linebox">
          <div>
            <div class="h4"><h4>费率(万分比)</h4></div>
            <div class="tablebox">
              <table>
                <tr>
                  <td>扫码支付</td>
                  <td>二维码支付</td>
                  <td>JS支付</td>
                  <td>WAP支付</td>
                  <td>APP支付</td>
                  <td>小程序支付</td>
                </tr>
                <tr>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="ecnyProfitRate[0]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="ecnyProfitRate[1]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="ecnyProfitRate[2]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="ecnyProfitRate[3]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="ecnyProfitRate[4]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="ecnyProfitRate[5]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
      <div class="wxbox">
        <div class="h4"><h4>龙支付</h4></div>
        <div class="linebox">
          <div>
            <div class="h4"><h4>费率(万分比)</h4></div>
            <div class="tablebox">
              <table>
                <tr>
                  <td>扫码支付</td>
                  <td>二维码支付</td>
                  <td>JS支付</td>
                  <td>WAP支付</td>
                  <td>APP支付</td>
                  <td>小程序支付</td>
                </tr>
                <tr>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="longpayProfitRate[0]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="longpayProfitRate[1]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="longpayProfitRate[2]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="longpayProfitRate[3]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="longpayProfitRate[4]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="longpayProfitRate[5]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div>
      <!-- <div class="wxbox">
        <div class="h4"><h4>掌上生活</h4></div>
        <div class="linebox">
          <div>
            <div class="h4"><h4>费率(万分比)</h4></div>
            <div class="tablebox">
              <table>
                <tr>
                  <td>扫码支付</td>
                  <td>二维码支付</td>
                  <td>JS支付</td>
                  <td>WAP支付</td>
                  <td>APP支付</td>
                  <td>小程序支付</td>
                </tr>
                <tr>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="cmblifeProfitRate[0]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="cmblifeProfitRate[1]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="cmblifeProfitRate[2]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="cmblifeProfitRate[3]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="cmblifeProfitRate[4]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="cmblifeProfitRate[5]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div> -->
      <!-- <div class="wxbox">
        <div class="h4"><h4>微企付</h4></div>
        <div class="linebox">
          <div>
            <div class="h4"><h4>费率(万分比)</h4></div>
            <div class="tablebox">
              <table>
                <tr>
                  <td>扫码支付</td>
                  <td>二维码支付</td>
                  <td>JS支付</td>
                  <td>WAP支付</td>
                  <td>APP支付</td>
                  <td>小程序支付</td>
                </tr>
                <tr>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wqfProfitRate[0]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wqfProfitRate[1]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wqfProfitRate[2]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wqfProfitRate[3]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wqfProfitRate[4]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                  <td>
                    <el-input
                      class="inputmini"
                      size="mini"
                      v-model="wqfProfitRate[5]"
                      placeholder=""
                    ></el-input
                    >‱
                  </td>
                </tr>
              </table>
            </div>
          </div>
        </div>
      </div> -->

      <div class="btnbox">
        <el-button type="primary" @click="addButton">新增通道</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { dictionarylist, APIAddAccess } from "@/api/api";
export default {
  data() {
    return {
      token: { token: sessionStorage.getItem("token") },
      upload:
        process.env.VUE_APP_BASE_URL +
        "/product/v31/api/merchant/uploadfile/upload",
      isIndeterminate: true,
      settlement: [],
      settlementList: ["T0", "T1", "D0", "D1"],
      wqfProfitRate: [],
      cmblifeProfitRate: [],
      longpayProfitRate: [],
      ecnyProfitRate: [],
      bestpayProfitRate: [],
      uniProfitRate: [],
      wxProfitRate: [],
      aliProfitRate: [],
      channelinfo: {
        icon: "",
        aliQr:'',
        wxQr:'',
      },
      channelslist: [
        {
          code: "100",
          options: "测试1",
        },
        {
          code: "101",
          options: "测试2",
        },
        {
          code: "102",
          options: "测试3",
        },
      ],
      splitTypeList:[
          {
          value: "0",
          label: "不支持",
        },
        {
          value: "1",
          label: "收付一体",
        },
        {
          value: "2",
          label: "仅分账 ",
        },
      ],
      channelStatus: [
        {
          value: "0",
          label: "正常",
        },
        {
          value: "1",
          label: "关闭",
        },
        {
          value: "99",
          label: "删除",
        },
      ],
      channelTypeList: [
        {
          value: "1",
          label: "乐收赢",
        },
        {
          value: "2",
          label: "第三方",
        },
      ],
      isEntryList: [
        {
          value: "0",
          label: "否",
        },
        {
          value: "1",
          label: "是",
        },
      ],
      isCardPayList: [
        {
          value: "0",
          label: "否",
        },
        {
          value: "1",
          label: "是",
        },
      ],
    };
  },
  created() {},
  methods: {
    // icon图片上传
    PicSuccess(res) {
      if (res.code == 405) {
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else if (res.code == 200) {
        this.$message({
          message: "上传成功",
          type: "success",
        });
        this.channelinfo.icon = res.data.filePath;
        console.log(this.channelinfo.icon);
      } else {
        this.$message.error(res.message);
      }
    },
    //微信授权码上传
    wxQrSuccess(res) {
      if (res.code == 405) {
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else if (res.code == 200) {
        this.$message({
          message: "上传成功",
          type: "success",
        });
        this.channelinfo.wxQr = res.data.filePath;
        console.log(this.channelinfo.wxQr);
      } else {
        this.$message.error(res.message);
      }
    },
    //支付宝授权码上传
    aliQrSuccess(res) {
      if (res.code == 405) {
        sessionStorage.removeItem("token");
        this.$router.push("/login");
      } else if (res.code == 200) {
        this.$message({
          message: "上传成功",
          type: "success",
        });
        this.channelinfo.aliQr = res.data.filePath;
        console.log(this.channelinfo.aliQr);
      } else {
        this.$message.error(res.message);
      }
    },
    CheckedChange(value) {
      this.channelinfo.settlement = value.join();
    },
    addButton() {
      if (!this.channelinfo.type) {
        this.$message({
          message: "请选择通道类型",
          type: "warning",
        });
        return;
      } else if (!this.channelinfo.paytype) {
        this.$message({
          message: "请输入通道支付类型",
          type: "warning",
        });
        return;
      } else if (!this.channelinfo.status) {
        this.$message({
          message: "请选择通道状态",
          type: "warning",
        });
        return;
      } else {
        this.channelinfo.wxProfitRate = this.wxProfitRate.join();
        this.channelinfo.aliProfitRate = this.aliProfitRate.join();
        this.channelinfo.uniProfitRate = this.uniProfitRate.join();
        this.channelinfo.bestpayProfitRate = this.bestpayProfitRate.join();
        this.channelinfo.ecnyProfitRate = this.ecnyProfitRate.join();
        this.channelinfo.longpayProfitRate = this.longpayProfitRate.join();
        this.channelinfo.cmblifeProfitRate = this.cmblifeProfitRate.join();
        this.channelinfo.wqfProfitRate = this.wqfProfitRate.join();
        APIAddAccess(this.channelinfo).then((res) => {
          console.log(res);
          if (res.code == 200) {
            this.$message({
              message: "新增成功",
              type: "success",
            });
            this.$router.push("/AccessControl");
            sessionStorage.setItem("refresh", true);
          } else {
            this.$message.error(res.message);
          }
        });
      }
    },
  },
};
</script>

<style lang="less" scoped>
/deep/ .el-upload {
  width: 80px;
  height: 80px;
}
.avatar-uploader-icon {
  font-size: 28px;
  color: #8c939d;
  width: 80px;
  height: 80px;
  line-height: 80px;
  text-align: center;
}
.title {
  background: #fff;
  padding: 10px;
  font-size: 18px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}
.container {
  width: 100%;
  margin-bottom: 20px;
  box-sizing: border-box;
  flex-wrap: wrap;
  .itemBox {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    border-bottom: 1px solid #eeeeee;
    padding-bottom: 10px;
    .line {
      width: 50%;
      display: flex;
      font-size: 14px;
      line-height: 200%;
      padding-bottom: 5px;
      .lineitem:nth-child(1) {
        width: 40%;
        text-align: right;
        padding-right: 10px;
      }
      .lineitem:nth-child(2) {
        width: 60%;
        text-align: left;
        color: #888888;
      }
      .lineitemIcon {
        width: 20%;
        text-align: left;
      }
      .inputsize {
        width: 65%;
      }
    }
  }
  .wxbox {
    margin: 10px 0;
    padding-bottom: 20px;
    border-bottom: 1px solid #eeeeee;
    .linebox {
      width: 100%;
      display: flex;
      flex-wrap: wrap;
      padding-top: 13px;
      .line1 {
        width: 100%;
        display: flex;
        font-size: 14px;
        line-height: 200%;
        margin-bottom: 5px;

        .lineitem1 {
          width: 12%;
          text-align: left;
        }
        .lineitem2 {
          width: 15%;
          text-align: left;
        }
      }
      .line {
        width: 48%;
        display: flex;
        font-size: 14px;
        line-height: 200%;
        margin-bottom: 13px;
        .lineitem:nth-child(1) {
          width: 40%;
          text-align: right;
          padding-right: 10px;
        }
        .lineitem:nth-child(2) {
          width: 60%;
          text-align: left;
          color: #888888;
        }
        .inputsize {
          width: 65%;
        }
      }
    }

    .tablebox {
      width: 100%;
      padding-top: 13px;
      table {
        border-top: 1px solid #999;
        border-left: 1px solid #999;
        border-spacing: 0;
        tr {
          width: 100%;
          td {
            padding: 10px 15px;
            border-bottom: 1px solid #999;
            border-right: 1px solid #999;
            text-align: center;
            .inputmini {
              width: 33%;
            }
            .inputlarge {
              width: 100%;
            }
            input {
              text-align: center !important;
            }
          }
        }
      }
    }
  }
  .btnbox {
    width: 100%;
    padding: 20px 0;
    text-align: center;
  }
  .h4 {
    padding-bottom: 10px;
    padding-top: 5px;
  }
}
</style>